package reduce.fz.com.reduce.service;

import android.content.Context;

import java.util.HashMap;
import java.util.List;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.abstracts.AbResponseListener;
import reduce.fz.com.reduce.abstracts.AbResponseListener3;
import reduce.fz.com.reduce.bean.ServiceException;
import reduce.fz.com.reduce.bean.Team;
import reduce.fz.com.reduce.bean.TeamCategory;
import reduce.fz.com.reduce.bean.TeamDynamic;
import reduce.fz.com.reduce.bean.page.Pagination;
import reduce.fz.com.reduce.bean.result.Result;
import reduce.fz.com.reduce.custom.inter.AbstractResponse;
import reduce.fz.com.reduce.util.ApiUtil;
import reduce.fz.com.reduce.util.HttpUtils;

/**
 * Created by qingshengzheng on 15/7/26.
 */
public class FindService {
    private Context context;

    public FindService(Context context) {
        this.context = context;
    }

    public void LoadFindTopic(HashMap<String, Object> params, AbResponseListener<List<TeamCategory>> listener) {
        String url = ApiUtil.getApi(context, R.array.api_account_bind);
        url = ApiUtil.parseUrlParams(url, params);
        HttpUtils.get(url, listener);
    }

    public void loadFindTeam(HashMap<String, Object> params, Pagination pagination, AbResponseListener<List<Team>> listener) {
        String url = ApiUtil.getApi(context, R.array.api_account_bind);
        url = ApiUtil.parseUrlParams(url, params);
        HttpUtils.get(url, listener);
    }

    public void addTeam(Long uid, Long teamid, AbResponseListener<Result> listener) {
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("uid", uid);
        param.put("teamid", teamid);
        String url = ApiUtil.getApi(context, R.array.api_account_bind);
        url = ApiUtil.parseUrlParams(url, param);
        HttpUtils.post(url, param, listener);
    }
    public void quitTeam(Long uid,Long teamid,AbResponseListener3 listener)
    {

    }

    public void loadBanners(AbResponseListener listener)
    {
        String url=ApiUtil.getApi(context,R.array.api_load_banners);
        HttpUtils.get(url,listener);
    }

    //0 视频 1用户 2 社团
    public void loadRecommendTag(int type,AbResponseListener listener)
    {
        String url=ApiUtil.getApi(context,R.array.api_recommend_tag,type);
        HttpUtils.get(url,listener);

    }


    public void queryTeamDynamic(Long teamid,AbResponseListener<TeamDynamic> listener)
    {
        HashMap<String,Object> params=new HashMap<String,Object>();
        params.put("teamid",teamid);
        String url=ApiUtil.getApi(context,R.array.api_account_bind);
        url=ApiUtil.parseUrlParams(url,params);
        HttpUtils.get(url,listener);
    }

    public void queryCategoryTags(AbResponseListener listener)
    {
        String url=ApiUtil.getApi(context,R.array.api_discover_categorys);
        HttpUtils.get(url,listener);
    }

}
